import React from 'react' 
import Header from '../../header/Header'
import ListUi from './ListUi'
import { useDispatch,useSelector } from 'react-redux'
import { useEffect } from 'react'
import { loadAsync } from '../../actionCreater'
import {
    Container
} from './StyledList'


const List = () => {
  let data = useSelector(state => state.daka.list)
  console.log(data);
  const dispatch = useDispatch()
  useEffect(()=>{
    let id =JSON.parse(sessionStorage.username) 
    let data = {
      "uid":id.uid
    }
    dispatch(loadAsync(data))
  },[dispatch])
  return ( 
    <Container>
          <Header
          title='打卡活动'
          back='true'
          right='新建'
          bgc='rgba(48,139,254)'
          to='/select'
          ></Header>
          <ListUi  data={data}></ListUi>
   </Container>
  );
}
 
export default List;